package com.muyu.user.controller;

import java.util.List;

import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.muyu.user.domain.SysUserCheckin;
import com.muyu.user.domain.req.SysUserCheckinQueryReq;
import com.muyu.user.domain.model.SysUserCheckinQueryModel;
import com.muyu.user.domain.model.SysUserCheckinPageQueryModel;
import com.muyu.user.domain.resp.SysUserCheckinPageResp;
import com.muyu.user.service.SysUserCheckinService;
import com.muyu.common.core.web.page.DataPageResp;
import com.muyu.common.core.web.page.PageQueryModel;

/**
 * 签到记录Controller
 *
 * @author liuguoqiang
 * @date 2025-09-18
 */
@RestController
@RequestMapping("/checkin")
@Tag(name = "签到记录", description = "签到记录控制层")
public class SysUserCheckinController extends BaseController {

    /**
    * 签到记录业务层
    */
    @Autowired
    private SysUserCheckinService sysUserCheckinService;

    /**
     * 查询签到记录列表
     */
    @Operation(summary = "获取签到记录列表", description = "获取签到记录列表")
    @RequiresPermissions("user:checkin:list")
    @GetMapping("/list")
    public Result<DataPageResp<SysUserCheckinPageResp>> list(SysUserCheckinQueryReq sysUserCheckinQueryReq) {
        PageQueryModel<SysUserCheckinPageQueryModel> pageQueryModel = sysUserCheckinService.pageQuery(SysUserCheckinQueryModel.reqBuild(sysUserCheckinQueryReq));
        return Result.success(DataPageResp.of(pageQueryModel).cover(SysUserCheckinPageResp::infoBuild));
    }

}
